import request from '@/utils/request'

/**
 * 查询权益列表
 * http://192.168.88.247:4999/web/#/80/547
 * @param {*} data
 * @returns
 */
export function listRights (data) {
  return request({
    url: '/v1/right/list',
    method: 'post',
    data
  })
}

/**
 * 权限下拉选择
 * http://192.168.88.247:4999/web/#/80/547
 * @returns
 */
// export function getRightsOption () {
//   return request({
//     url: '/v1/right/getid',
//     method: 'get'
//   })
// }

/**
 * 新增权益
 * http://192.168.88.247:4999/web/#/80/547
 * @param {*} data
 * @returns
 */
export function addRights (data) {
  return request({
    url: '/v1/right/create',
    method: 'post',
    data: data
  })
}

/**
 * 修改权益
 * http://192.168.88.247:4999/web/#/80/547
 * @param {*} data
 * @returns
 */
export function updateRights (data) {
  return request({
    url: '/v1/right/update',
    method: 'put',
    data: data
  })
}
/**
 * 更新权益版本
 * http://192.168.88.247:4999/web/#/80/2116
 * @param {*} data
 * @returns
 */
export function updateRightsVersion (data) {
  return request({
    url: '/v1/right/update_version',
    method: 'post',
    data: data
  })
}

/**
 * 删除权益
 * http://192.168.88.247:4999/web/#/80/547
 * @param {*} menuId 权益ID
 * @returns
 */
export function delRights (right_id) {
  return request({
    url: '/v1/right',
    method: 'delete',
    data: { right_id }
  })
}

// 权益上下架
export function updateSaleStatus (data) {
  return request({
    url: '/v1/right/sale',
    method: 'put',
    data
  })
}
// 上传
export function uploadApi (data) {
  return request({
    url: '/admin-api/v1/upload',
    headers: {
      'content-type': 'multipart/form-data'
    },
    method: 'post',
    data
  })
}
